// index.js
// 获取应用实例
const API = require("../../http/API")
const http = require("../../http/http")
Page({
  data: {
    // 轮播图片
    lunbopic: '',
    option: [{
        text: "免费教程",
        iconUrl: "https://assets-cdn.lanqb.com/imgv3_m/images-icon/submenu/h9-b_1806.png"
      },
      {
        text: "专业课程",
        iconUrl: "https://assets-cdn.lanqb.com/imgv3_m/images-icon/submenu/h12-g_1806.png"
      },
      {
        text: "大触直播",
        iconUrl: "https://assets-cdn.lanqb.com/imgv3_m/images-icon/submenu/h2-p_2212.png"
      },
      {
        text: "教程兑换",
        iconUrl: "https://assets-cdn.lanqb.com/imgv3_m/images-icon/submenu/h10-o_1806.png"
      },
      {
        text: "学员成长",
        iconUrl: "https://assets-cdn.lanqb.com/imgv3_m/images-icon/submenu/h11-c_2212.png"
      },
      {
        text: "每日一画",
        iconUrl: "https://assets-cdn.lanqb.com/imgv3_m/images-icon/submenu/h11-c_1811.png"
      },
      {
        text: "素材下载",
        iconUrl: "https://assets-cdn.lanqb.com/imgv3_m/images-icon/submenu/h14-r_2212.png"
      },
      {
        text: "社区问答",
        iconUrl: "https://assets-cdn.lanqb.com/imgv3_m/images-icon/submenu/h5-p_2211.png"
      },
    ],
    dachu: '',
    remen: '',
    wenda: '',
    sucai: '',
  },
  jiaocinfo() {
    wx.navigateTo({
      url: '/pages/jiaocinfo/jiaocinfo',
    })
  },
  onLoad() {
    // 大触直播
    http(API.daniu).then(res => {
      this.setData({
        dachu: res.data
      })
    })
    // 轮播
    http(API.homeBanner).then(res => {
      this.setData({
        lunbopic: res.data.data
      })
    })
    // 热门教程
    http(API.homeSeries).then(res => {
      this.setData({
        remen: res.data.slice(0, 4)
      })
    })
    // 问答专区
    http(API.homeHeatqaList).then(res => {
      console.log(res);
      this.setData({
        wenda: res.data.slice(0, 3)
      })
    })
    // 素材下载
    http(API.news).then(res => {
      this.setData({
        sucai: res.data.data.slice(0, 3)
      })
    })

  }
})